<?php
/**
 *
 * PHP 5
 *
 * CakePHP(tm) : Rapid Development Framework (http:/.org)
 * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http:/.org CakePHP(tm) Project
 * @package       Cake.View.Layouts
 * @since         CakePHP(tm) v 0.10.0.1076
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
$cakeDescription = __d('cake_dev', 'CakePHP: the rapid development php framework');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <?php echo $this->Html->charset(); ?>
        <title>
            <?php echo $title_for_layout; ?>
        </title>
        <?php
        # Import styling files.
        echo $this->Html->meta('icon');
        echo $this->Html->script('bootstrap.min');
        echo $this->Html->css('bootstrap.min');
        echo $this->Html->script(array('jquery-1.7.2.min',
            'jquery-ui-1.8.19.custom.min',
            'bootstrap.min'));
        echo $this->Html->css(array('bootstrap.min',
            'jquery-ui-1.8.19.custom.css'));

        # Fetch imported files.
        echo $this->fetch('meta');
        echo $this->fetch('css');
        echo $this->fetch('script');
        ?>

        <!-- Le styles -->
        <style type="text/css">
            body {
                padding-top: 60px;
                padding-bottom: 40px;
            }

            .container{
                padding-left: 10px;
            }

            .well{
                padding-left: 10px;
            }
        </style>
        <?php echo $this->Html->css('bootstrap.min'); ?>
    </head>

    <body>

        <div class="navbar navbar-fixed-top">
            <div class="navbar-inner">
                <div class="container-fluid">
                    <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </a><!--btn-navbar-->
                    <a class="brand" href="tattlr.com">Tattlr</a>
                    <div class="nav-collapse">
                        <ul class="nav">
                            <li><a href="#" id = "dash"><i  class ="icon-home icon-white"></i> Dashboard</a></li>
                            <li><a href="#" id="home">Home Timeline</a></li>
                            <li><a href="#" id="followers">View followers</a></li>
                            <li><a href="/Tweets">Search</a></li>
                            <?php if (Configure::read('ad') == 0) { ?>
                                <li><a href="/tasks/viewAll">Tasks</a></li>
                            <?php } ?>
                            <li><a href="/FutureDms/">View DMs</a></li>
                            <li><a href="/FutureTweets">FutureTweets</a></li>
                            <li><a href="/events">Events</a></li>
                            <li><a href="/tattlraccounts/selectAccount">Select Account</a></li>
                            <?php if (Configure::read('ad') == 1) { ?>
                                <li><a href="/tattlraccounts/">Admin</a></li>
                            <?php } ?>
                            <li><a href="/Users/logout">logout</a></li>
                            <li><a href="/tattlraccounts/db">.</a></li> 
                        </ul>
                    </div> 
                </div><!--container-->
            </div><!--.navbar-inner-->
        </div><!--navbar-->

        <div class = "container-fluid2">
            <div class="row-fluid">
                <div class="span3">
                    <div class="well pull-left">
                        <ul class="nav nav-list">

                        </ul>
                    </div><!--well-->
                    <?php //echo $this->element('sql_dump');  ?>
                </div><!--span3-->

                <div class ="span6">
                    <?php echo $this->Session->flash(); ?>
                    <?php echo $this->fetch('content'); ?>
                    <?php //echo $this->element('sql_dump'); ?>
                </div><!--span6-->
            </div><!--row-fluid-->
        </div><!--container-fluid-->
        <script type="text/javascript">
            $(document).ready(function() {
                $.ajaxSetup({
                    cache: true
                });

                //Loading Image.
                var ajax_load = "<img src='http://d2o0t5hpnwv4c1.cloudfront.net/412_ajaxCalls/DEMO/img/load.gif' alt='loading...' style='top:48%; left:48%; position:relative;'/>";

                //PHP file URL.
                var loadUrl = "/Posts/index";
                var loadUrl2 = "/Posts/fetchHome";
                var loadUrl3 = "/accounts/getFollowers";
 
                $(document).on("click", "#dash", function(){ 
                    $(".container-fluid2").html(ajax_load);  
                    $.get(  
                    loadUrl,  
                    {language: "php", version: 5},  
                    function(responseText){  
                        $(".container-fluid2").html(responseText);
                        $("#CancelReply").hide();
                        history.replaceState(null, "Dashboard", "/posts");
                        $(document).attr('title','Dashboard');
                    },  
                    "html"  
                ); 
                });
                $(document).on("click", "#home", function(){ 
                    $(".container-fluid2").html(ajax_load);  
                    $.get(  
                    loadUrl2,
                    {language: "php", version: 5},  
                    function(responseText){  
                        $(".container-fluid2").html(responseText);
                        $("#CancelReply").hide();
                        history.replaceState(null, "Timeline", "/posts/fetchHome");
                        $(document).attr('title','Timeline');
                    },  
                    "html"  
                );  
                });  
                $(document).on("click", "#followers", function(){
                    $(".container-fluid2").html(ajax_load);  
                    $.get(  
                    loadUrl3,  
                    {language: "php", version: 5},  
                    function(responseText){  
                        $(".container-fluid2").html(responseText); 
                        $("#CancelReply").hide();
                        history.replaceState(null, "View followers", "/accounts/getFollowers");
                        $(document).attr('title','Followers');
                    },  
                    "html"  
                );  
                });  
            });  
        </script>
    </body>
</html>

